﻿using UnityEngine;
using QFramework;
using HKTools;

public class Test_UseSimpleDialog : HKSimpleDialog_BaseController
{
    [SerializeField] HK_SimpleDialog3D simpleDialog3D;

    void Start()
    {
        this.RegisterEvent<Event_DialogStart>(args =>
        {
            Debug.LogFormat("<color=#65F524>新的对话：{0} 开始！</color>", args._dialogName);
        }).UnRegisterWhenGameObjectDestroyed(gameObject);

        this.RegisterEvent<Event_DialogEnd>(args =>
        {
            Debug.LogFormat("<color=#65F524>当前对话：{0} 结束！</color>", args._dialogName);
        }).UnRegisterWhenGameObjectDestroyed(gameObject);

        this.RegisterEvent<Event_OptionChoiced>(args =>
        {
            Debug.LogFormat("<color=#65F524>选择了：{0}</color>", args._optionText);
        }).UnRegisterWhenGameObjectDestroyed(gameObject);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
            this.SendCommand(new CMD_StartNewDialog3D("测试对话", true, simpleDialog3D));
        }

        if (Input.GetKeyDown(KeyCode.F2))
        {
            this.SendCommand(new CMD_EndCurDialog3D());
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            this.SendCommand(new CMD_PlayForwardDialog());
        }
    }
}
